Refactor namespaces with singleton keys#300
Merged
Merged
Conversation
…0, and gov/constitution/v0
6760957 to
b4ae492
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors three namespaces (entities/committee/v0, gov/committee/v0, gov/constitution/v0) that semantically only ever have a single entry: their NamespaceKeySize is changed from 8 (previously an epochNo) to 1, reflecting a singleton 1-byte key.
Changes:
- Set
NamespaceKeySize "entities/committee/v0" = 1(was 8). - Set
NamespaceKeySize "gov/committee/v0" = 1(was 8). - Set
NamespaceKeySize "gov/constitution/v0" = 1(was 8).
Comments suppressed due to low confidence (3)
scls-cardano/cddl-src/Cardano/SCLS/CDDL.hs:122
- The key size for
gov/committee/v0was reduced from 8 to 1 (singleton key), but the kaitai schema in therecord_entrycomment inCardano/SCLS/Namespace/GovCommittee.hs(lines 30-35) still describes the key asepoch: u8(8 bytes). That documentation is now inconsistent with the actual key size and should be updated to describe the new 1-byte singleton key.
type instance Spec.NamespaceKeySize "gov/committee/v0" = 1
scls-cardano/cddl-src/Cardano/SCLS/CDDL.hs:123
- The key size for
gov/constitution/v0was reduced from 8 to 1 (singleton key), but the kaitai schema in therecord_entrycomment inCardano/SCLS/Namespace/GovConstitution.hs(lines 29-33) still describes the key asepoch: u8(8 bytes). That documentation is now inconsistent with the actual key size and should be updated to describe the new 1-byte singleton key.
type instance Spec.NamespaceKeySize "gov/constitution/v0" = 1
scls-cardano/cddl-src/Cardano/SCLS/CDDL.hs:123
- For consistency with the other singleton entries in this file (e.g.
nonces/v0on line 114 andgov/proposals/roots/v0on line 126), please add a trailing comment explaining what the single byte represents (e.g.-- Just zero/ singleton key), to make the intent clear and match the established style for 1-byte singleton namespaces.
type instance Spec.NamespaceKeySize "entities/committee/v0" = 1
type instance Spec.NamespaceKeySize "entities/dreps/v0" = 29 -- 1 byte for tag, 28 bytes for hash
type instance Spec.NamespaceKeySize "entities/stake_pools/v0" = 28
type instance Spec.NamespaceKeySize "entities/stake_pools/vrf_key_hashes/v0" = 32
type instance Spec.NamespaceKeySize "gov/committee/v0" = 1
type instance Spec.NamespaceKeySize "gov/constitution/v0" = 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
qnikst
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some namespaces should only have a single entry. For these namespaces, epochNo was being used, which doesn't make sense.
This PR refactor such namespaces to use a singleton value (1-byte) for the key.